home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / C / KeyPressed.doc < prev    next >
Text File  |  1995-08-30  |  3KB  |  84 lines

  1.  
  2.             ========================================================
  3.              KeyPressed 36.1 (30.8.95) Copyright (c) Ralph Seichter
  4.             ========================================================
  5.  
  6.  
  7. DESCRIPTION
  8.  
  9.    This tool checks if at least one key of a given list of keys is pressed
  10. and delivers an appropriate return code, which can be processed in shell
  11. scripts to trigger any action you like.
  12.  
  13.    To give you an idea of what "KeyPressed" can do for you, imagine that
  14. you have three different startup-sequences around. Number 1 is the one for
  15. everyday use, the standard startup. Number 2 and 3 are optimized versions
  16. for special applications. When you want to execute number 2 or 3 on bootup,
  17. you could boot once without a startup-sequence, then copy the desired file
  18. over your standard startup (make sure to backup Number 1 first), and then
  19. reboot your Amiga. Does this sound inconvenient? It is.
  20.  
  21.    "KeyPressed" will help you out of your misery. Include the following
  22. lines somewhere at the beginning of your S:startup-sequence (your standard
  23. startup file) and copy "KeyPressed" to your C: directory or elsewehere in
  24. your command path.
  25.  
  26.         KeyPressed 64
  27.         IF WARN
  28.             ; KeyPressed reports that the space bar (raw key code 64)
  29.             ; was pressed. Execute alternate startup-sequence number 2.
  30.             Execute S:startup-sequence.2
  31.             EndCLI >NIL:
  32.             Quit
  33.         ENDIF
  34.  
  35.         KeyPressed 96 97 99
  36.         IF WARN
  37.             ; The control key (raw key code 99), the left shift key (96)
  38.             ; or the right shift key (97) was pressed. Execute alternate
  39.             ; startup-sequence number 3.
  40.             Execute S:startup-sequence.3
  41.             EndCLI >NIL:
  42.             Quit
  43.         ENDIF
  44.  
  45.    As you can see, "KeyPressed" requires a list of decimal raw key codes.
  46. You can supply as many codes as you wish, but as there is only a fixed
  47. number of keys on a keyboard, there is a natural limit implied. :)
  48.  
  49. "KeyPressed" will return the code 5 (RETURN_WARN) if at least one of the
  50. specified key was pressed, and otherwise 0 (RETURN_OK) is returned. Please
  51. Note that raw key codes are *DIFFERENT* from ASCII codes. Here is a list of
  52. selected codes common to all Amiga models:
  53.  
  54.         Key name                Code
  55.         Space bar               64
  56.         Enter (numeric keypad)  67
  57.         Return                  68
  58.         F1 - F10                80 - 89
  59.         Help                    95
  60.  
  61.    For a complete list of the Amiga's raw key codes, please have a look at
  62. the ROM Kernel Reference Manual "Devices" (section "console.device").
  63.  
  64.  
  65. COPYRIGHT NOTICE
  66.  
  67.    "KeyPressed" is Copyright (c) Ralph Seichter, all rights reserved. You
  68. have permission to use this tool freely and make as many copies as you
  69. wish. You *MUST NOT* charge other people for supplying them with copies of
  70. "KeyPressed". Adding any files to or removing files from the distribution
  71. archive is *PROHIBITED*.
  72.  
  73.  
  74. DISCLAIMER
  75.  
  76.    THIS MATERIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
  77. EXPRESS OR IMPLIED, STATUTORY OR OTHERWISE, INCLUDING WITHOUT LIMITATION
  78. ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY AND FITNESS FOR
  79. A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE USE, RESULTS, AND
  80. PERFORMANCE OF THIS MATERIAL IS ASSUMED BY YOU AND IF THE PRODUCT SHOULD
  81. PROVE TO BE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL NECESSARY
  82. SERVICING, REPAIR, OR OTHER REMEDIATION.
  83.  
  84.